// <?php
/*
 * -File        $Id: log.action.php,v 1.1 2005/04/29 18:14:58 amadeus Exp $
 * -License     LGPL (http://www.gnu.org/copyleft/lesser.html)
 * -Copyright   2002, Nexista
 * -Author      joshua savage, js@nexista.com
 */

/**
 * @package     Nexista
 * @subpackage  Actions
 * @author      Joshua Savage <js@nexista.com>
 */
 
/**
 * CUSTOM USER ACTION
 * 
 * This action logs info in DB. it accepets a 3 letter code and a target ID.
 * It will attempt to located the value of the ID by  looking in the metabase_sequences
 * or the GET/POST query.
 *
 * @package     Nexista
 * @subpackage  Actions
 */

class logAction extends Action
{


    /**
     * Function parameter array
     *
     * @var     array
     */

    protected  $params = array(
        'code' => '',   //required - 3 letter action code
        'target' => ''  //optional - target ID/name of action
        );


    /**
     * Applies action
     *
     * @return  boolean success
     */

    protected  function main()
    {
    
        //slap the params in flow
        if(isset($GLOBALS['metabase_sequences'][$this->params['target']]))
            $target= $GLOBALS['metabase_sequences'][$this->params['target']];
        elseif(isset($_REQUEST[$this->params['target']]))
            $target = $_REQUEST[$this->params['target']];
        else
            $target = '';    
       
        //globals://metabase_sequences/article_id
        Flow::add('log_action',$this->params['code']);
        Flow::add('log_target',$target);
       
        //call a query
        $query =& new QueryHandler('/home/lotus/assets/qry/activity/log_add.xml');
        $query->process();
        
        return true;
    }



} //end class

?>
